<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<cfsilent>
<!---
Kalendar

COPYRIGHT & LICENSING INFO
-------------------------------------------------------------------

Copyright 2006 TJ Downes - tdownes@sanative.net - http://www.sanative.net

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

--->
<!--- default view to large month format. Acceptable types: month, week, list (mini calendar) --->

<cfparam name="view" default="month" type="string" />
<cfparam name="categoryID" default="0" type="numeric" />
<cfparam name="linkDate" default="" />

<!--- ERROR PREVENTION: prevents errors by intentional munging of the URL --->
<cfif StructKeyExists(url, "view")>
	<cfset variables.view = url.view />
</cfif>
<cfif StructKeyExists(form, "view")>
	<cfset variables.view = form.view />
</cfif>

<cfif NOT ListFindNoCase('day,weeklist,list,month,week,rss',variables.view)>
	<cfset view = "list" />
</cfif>

<cfif StructKeyExists(url, "linkDate")>
	<cfset variables.LinkDate = url.LinkDate />
</cfif>
<cfif StructKeyExists(form, "linkDate")>
	<cfset variables.LinkDate = form.LinkDate />
</cfif>

<cfif StructKeyExists(url, "categoryID")>
	<cfset variables.categoryID = url.categoryID />
</cfif>
<cfif StructKeyExists(form, "categoryID")>
	<cfset variables.categoryID = form.categoryID />
</cfif>

<!--- LinkDate initializes the calendar to the set date --->
<cfif NOT isDate(variables.LinkDate)>
	<cfset variables.LinkDate = DateFormat(Now(), 'mmmm d, yyyy') />
</cfif>
<cfswitch expression="#variables.view#">
<!--- instantiate object for Kalendar rss data --->
	<cfcase value="rss">
	<cfinvoke component="#application.KConfig.getCFCPath()#kalendar" method="KalendarXML" returnvariable="rss">
		<cfif NOT Compare(variables.view, "list")>
			<cfinvokeargument name="view" value="month" />
		<cfelseif NOT Compare(variables.view, "weeklist")>
			<cfinvokeargument name="view" value="week" />
		<cfelse>
			<cfinvokeargument name="view" value="#variables.view#" />
		</cfif>
		<cfinvokeargument name="timeHeaderClass" value="timeHeader" />
		<cfinvokeargument name="LinkDate" value="#CreateODBCDate(variables.LinkDate)#" />
		<cfinvokeargument name="PublicOnly" value="1" />
		<cfif variables.categoryID neq 0>
			<cfinvokeargument name="categoryID" value="#variables.categoryID#" />
		</cfif>
	</cfinvoke>
	<cfsetting enablecfoutputonly="yes">
	</cfcase>
	<!--- instantiate object for Kalendar data --->
	<cfdefaultcase>
	<cfinvoke component="#application.KConfig.getCFCPath()#kalendar" method="getCalendar" returnvariable="returnedEvents">
		<cfif NOT Compare(variables.view,"list")>
		<cfinvokeargument name="view" value="month" />
		<cfelseif NOT Compare(variables.view,"weeklist")>
		<cfinvokeargument name="view" value="week" />
		<cfelse>
		<cfinvokeargument name="view" value="#variables.view#" />
		</cfif>
		<cfinvokeargument name="timeHeaderClass" value="timeHeader" />
		<cfinvokeargument name="LinkDate" value="#CreateODBCDate(variables.LinkDate)#" />
		<cfinvokeargument name="PublicOnly" value="1" />
		<cfif variables.categoryID neq 0>
			<cfinvokeargument name="categoryID" value="#variables.categoryID#" />
		</cfif>
	</cfinvoke>
	</cfdefaultcase>
</cfswitch>
</cfsilent>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Kalendar</title>
	<link href="<cfoutput>#application.KConfig.getKalendarURLPath()#</cfoutput>common/css/kalendar.css" rel="stylesheet" type="text/css" />
	<link rel="alternate" type="application/rss+xml" title="Kalendar of Events for <cfoutput>#DateFormat(variables.LinkDate, "mmmm yyyy")#</cfoutput>" href="http://<cfoutput>#cgi.server_name##cgi.script_name#?view=rss</cfoutput>" />
</head>
<body>
<div class="clearfix" style="width:750px; margin-left: auto; margin-right: auto; margin-bottom: 25px;">
	<div style="float:left; text-align:left; width:300px;"><a href="<cfoutput>#application.KConfig.getKalendarURLPath()#</cfoutput>admin/kalendar/">admin</a>&nbsp;&middot;&nbsp;<a href="http://kalendar.riaforge.org/">download</a>&nbsp;&middot;&nbsp;<a href="http://kalendar.sanative.net/README.txt">README</a>&nbsp;&middot;&nbsp;<a href="http://kalendar.sanative.net/HISTORY.txt">HISTORY</a></div>
	<div style="float:right; width:25px; text-align:right; width:25px;"><a href="http://<cfoutput>#cgi.server_name##cgi.script_name#?view=rss</cfoutput>"><img src="<cfoutput>#application.KConfig.getKalendarURLPath()#</cfoutput>common/images/rssfeed16x16.gif" alt="RSS" /></a></div>
</div>

<cfswitch expression="#variables.view#">
	<cfcase value="rss">
	<cfcontent type="text/xml" reset="true">
	<cfoutput>#variables.rss#</cfoutput>
	<cfsetting showdebugoutput="no" />
	<cfabort />
	</cfcase>
	<cfdefaultcase>
<div style="margin-left: auto; margin-right: auto; width:750px;">
<cfmodule template="#application.KConfig.getKalendarURLPath()#common/tags/kalendar.cfm"
		view="#variables.view#"
		eventrecords="#variables.returnedEvents#"
		linkdate="#variables.LinkDate#"
		categoryid="#variables.categoryID#"
		excludetimeheader="no"
		tooltipsublength="50"
		maxdescriptionsize="150"
		calendarlinkpage="eventdetails.cfm"
		includedetailsunderminicalendar="1"
		minicalendardetailsincludepath="common/includes/inc_underminicalendar.cfm">
	</cfdefaultcase>
</cfswitch>
version: <cfoutput>#application.KConfig.getKalendarBuildNumber()#</cfoutput>
</div>
</body>
</html>